﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:m="clr-namespace:GMap.NET.WindowsPresentation;assembly=GMap.NET.WindowsPresentation"
             xmlns:w="http://schemas.jelle.druyts.net/2010/xaml/presentation"
             xmlns:svc="clr-namespace:Schedulr.Views.Controls"
             x:Class="Schedulr.Views.Controls.PictureDetails"
             d:DesignHeight="500"
             d:DesignWidth="500"
             mc:Ignorable="d">
    <Grid>
        <Grid>
            <Grid.Style>
                <Style TargetType="Grid">
                    <Setter Property="Visibility" Value="Collapsed" />
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Path=Picture}" Value="{x:Null}">
                            <Setter Property="Visibility" Value="Visible" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Grid.Style>
            <TextBlock Text="Please select one or more files to edit" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="{DynamicResource InfoFontBrush}" />
        </Grid>
        <Grid>
            <Grid.Style>
                <Style TargetType="Grid">
                    <Setter Property="Visibility" Value="Visible" />
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Path=Picture}" Value="{x:Null}">
                            <Setter Property="Visibility" Value="Collapsed" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Grid.Style>
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Auto">
                <StackPanel Margin="5">
                    <Expander Header="Online" Margin="0,0,0,10" Visibility="{Binding OnlineDetailsVisibility}" IsExpanded="{Binding Path=UISettings.OnlinePanelIsExpanded, FallbackValue=True}">
                        <StackPanel>
                            <Label Content="Web Page" />
                            <TextBlock><w:ExternalHyperlink Foreground="{DynamicResource InfoFontBrush}" NavigateUri="{Binding Path=Picture.WebUrl}" ToolTip="{Binding Path=Picture.WebUrl}"><Run Text="{Binding Path=Picture.Title}" /></w:ExternalHyperlink></TextBlock>
                            <Label Content="Date Uploaded" />
                            <TextBlock Foreground="{DynamicResource InfoFontBrush}" Text="{Binding Path=Picture.DateUploaded, StringFormat=f}" />
                        </StackPanel>
                    </Expander>
                    <Expander Header="Details" Margin="0,0,0,0" IsExpanded="{Binding Path=UISettings.DetailsPanelIsExpanded, FallbackValue=True}">
                        <StackPanel>
                            <Grid Visibility="{Binding FileDetailsVisibility}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <StackPanel Grid.Column="0">
                                    <Label Content="_Path" Target="{Binding ElementName=fileNameTextBox, Mode=OneWay}" />
                                    <TextBox IsReadOnly="True" x:Name="fileNameTextBox" Text="{Binding Path=Picture.FileName, Mode=OneWay}" PreviewMouseLeftButtonUp="fileNameTextBox_PreviewMouseLeftButtonUp">
                                        <TextBox.Style>
                                            <Style TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
                                                <Style.Triggers>
                                                    <DataTrigger Binding="{Binding Path=FileNameLinkEnabled}" Value="true">
                                                        <Setter Property="TextDecorations" Value="Underline" />
                                                        <Setter Property="Cursor" Value="Hand" />
                                                    </DataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                        </TextBox.Style>
                                    </TextBox>
                                </StackPanel>
                                <StackPanel Grid.Column="1" Margin="5,0,0,0">
                                    <Label Content="_Size" Target="{Binding ElementName=fileSizeTextBox, Mode=OneWay}" />
                                    <TextBox IsReadOnly="True" x:Name="fileSizeTextBox" Text="{Binding Path=FileSizeDescription, Mode=OneWay}">
                                        <TextBox.Style>
                                            <Style TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
                                                <Style.Triggers>
                                                    <DataTrigger Binding="{Binding FileSizeErrorVisibility}" Value="Visible">
                                                        <Setter Property="BorderBrush" Value="{DynamicResource ErrorForegroundBrush}" />
                                                        <Setter Property="Foreground" Value="{DynamicResource ErrorForegroundBrush}" />
                                                        <Setter Property="ToolTip" Value="The file is larger than the maximum file size you are allowed to upload." />
                                                    </DataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                        </TextBox.Style>
                                    </TextBox>
                                </StackPanel>
                            </Grid>
                            <Label Content="_Title" Target="{Binding ElementName=titleTextBox, Mode=OneWay}" />
                            <TextBox x:Name="titleTextBox" Text="{Binding Path=Picture.Title, Mode=TwoWay}" IsReadOnly="{Binding IsReadOnly}" />
                            <Label Content="_Description" Target="{Binding ElementName=descriptionTextBox, Mode=OneWay}" />
                            <TextBox x:Name="descriptionTextBox" Text="{Binding Path=Picture.Description, Mode=TwoWay}" Height="100" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" TextWrapping="Wrap" IsReadOnly="{Binding IsReadOnly}" />
                            <Label Content="{Binding TagsLabel}" Target="{Binding ElementName=tagsTextBox, Mode=OneWay}" />
                            <TextBox x:Name="tagsTextBox" Text="{Binding Path=Picture.Tags, Mode=TwoWay}" IsReadOnly="{Binding IsReadOnly}" />
                        </StackPanel>
                    </Expander>
                    <Expander Header="Settings" Margin="0,10,0,0" IsExpanded="{Binding Path=UISettings.SettingsPanelIsExpanded, FallbackValue=True}">
                        <WrapPanel>
                            <StackPanel Margin="0,0,20,0">
                                <Label Content="_Visibility" Target="{Binding ElementName=visibilityIsPublicCheckBox, Mode=OneWay}" />
                                <CheckBox x:Name="visibilityIsPublicCheckBox" ToolTip="Visible to everyone" IsChecked="{Binding Path=Picture.VisibilityIsPublic, Mode=TwoWay}" IsEnabled="{Binding IsEditable}"><Label Style="{DynamicResource InlineLabel}" Content="Public" /></CheckBox>
                                <CheckBox x:Name="visibilityIsFamilyCheckBox" ToolTip="Visible to your family" IsChecked="{Binding Path=Picture.VisibilityIsFamily, Mode=TwoWay}" IsEnabled="{Binding IsEditable}"><Label Style="{DynamicResource InlineLabel}" Content="Family" /></CheckBox>
                                <CheckBox x:Name="visibilityIsFriendCheckBox" ToolTip="Visible to your friends" IsChecked="{Binding Path=Picture.VisibilityIsFriend, Mode=TwoWay}" IsEnabled="{Binding IsEditable}"><Label Style="{DynamicResource InlineLabel}" Content="Friends" /></CheckBox>
                            </StackPanel>
                            <StackPanel Margin="0,0,20,0">
                                <Label Content="S_earch Visibility" Target="{Binding ElementName=searchVisibilityIsNoneRadioButton, Mode=OneWay}" />
                                <RadioButton x:Name="searchVisibilityIsNoneRadioButton" ToolTip="Use the default value you configured on your Flickr account" IsChecked="{Binding Path=Picture.SearchVisibility, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=None}" IsEnabled="{Binding IsEditable}"><Label Style="{DynamicResource InlineLabel}" Content="Default" /></RadioButton>
                                <RadioButton x:Name="searchVisibilityIsVisibleRadioButton" ToolTip="Publicly searchable" IsChecked="{Binding Path=Picture.SearchVisibility, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=Visible}" IsEnabled="{Binding IsEditable}"><Label Style="{DynamicResource InlineLabel}" Content="Visible" /></RadioButton>
                                <RadioButton x:Name="searchVisibilityIsHiddenRadioButton" ToolTip="Hidden from public areas, such as Search and Explore" IsChecked="{Binding Path=Picture.SearchVisibility, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=Hidden}" IsEnabled="{Binding IsEditable}"><Label Style="{DynamicResource InlineLabel}" Content="Hidden" /></RadioButton>
                            </StackPanel>
                            <StackPanel Margin="0,0,20,0">
                                <Label Content="_Safety" Target="{Binding ElementName=safetyIsNoneRadioButton, Mode=OneWay}" />
                                <RadioButton x:Name="safetyIsNoneRadioButton" ToolTip="Use the default value you configured on your Flickr account" IsChecked="{Binding Path=Picture.Safety, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=None}" IsEnabled="{Binding IsEditable}"><Label Style="{DynamicResource InlineLabel}" Content="Default" /></RadioButton>
                                <RadioButton x:Name="safetyIsSafeRadioButton" ToolTip="Content suitable for a global, public audience" IsChecked="{Binding Path=Picture.Safety, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=Safe}" IsEnabled="{Binding IsEditable}"><Label Style="{DynamicResource InlineLabel}" Content="Safe" /></RadioButton>
                                <RadioButton x:Name="safetyIsModerateRadioButton" ToolTip="If you're not sure whether your content is suitable for a global, public audience but you think that it doesn't need to be restricted per se, this category is for you" IsChecked="{Binding Path=Picture.Safety, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=Moderate}" IsEnabled="{Binding IsEditable}"><Label Style="{DynamicResource InlineLabel}" Content="Moderate" /></RadioButton>
                                <RadioButton x:Name="safetyIsRestrictedRadioButton" ToolTip="This is content you probably wouldn't show to your mum, and definitely shouldn't be seen by kids" IsChecked="{Binding Path=Picture.Safety, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=Restricted}" IsEnabled="{Binding IsEditable}"><Label Style="{DynamicResource InlineLabel}" Content="Restricted" /></RadioButton>
                            </StackPanel>
                            <StackPanel Margin="0,0,20,0">
                                <Label Content="Ty_pe" Target="{Binding ElementName=contentTypeIsNoneRadioButton, Mode=OneWay}" Foreground="{DynamicResource InputFontColor}" />
                                <RadioButton x:Name="contentTypeIsNoneRadioButton" ToolTip="Use the default value you configured on your Flickr account" IsChecked="{Binding Path=Picture.ContentType, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=None}" IsEnabled="{Binding IsEditable}"><Label Style="{DynamicResource InlineLabel}" Content="Default" /></RadioButton>
                                <RadioButton x:Name="contentTypeIsPhotoRadioButton" ToolTip="Photos or videos" IsChecked="{Binding Path=Picture.ContentType, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=Photo}" IsEnabled="{Binding IsEditable}"><Label Style="{DynamicResource InlineLabel}" Content="Photo" /></RadioButton>
                                <RadioButton x:Name="contentTypeIsScreenshotRadioButton" ToolTip="Screenshots or screencasts" IsChecked="{Binding Path=Picture.ContentType, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=Screenshot}" IsEnabled="{Binding IsEditable}"><Label Style="{DynamicResource InlineLabel}" Content="Screenshot" /></RadioButton>
                                <RadioButton x:Name="contentTypeIsOtherRadioButton" ToolTip="Illustration, art, animation, CGI or other non-photographic images" IsChecked="{Binding Path=Picture.ContentType, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=Other}" IsEnabled="{Binding IsEditable}"><Label Style="{DynamicResource InlineLabel}" Content="Other" /></RadioButton>
                            </StackPanel>
                            <StackPanel Margin="0,0,20,0">
                                <Label Content="_License" Target="{Binding ElementName=licenseComboBox, Mode=OneWay}" Foreground="{DynamicResource InputFontColor}" />
                                <ComboBox x:Name="licenseComboBox" IsEnabled="{Binding IsEditable}">
                                    <ComboBoxItem x:Name="licenseIsNoneRadioButton" Content="Default" ToolTip="Use the default value you configured on your Flickr account" IsSelected="{Binding Path=Picture.License, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=None}" IsEnabled="{Binding IsEditable}" />
                                    <ComboBoxItem x:Name="licenseIsAllRightsReservedRadioButton" Content="None (All rights reserved)" IsSelected="{Binding Path=Picture.License, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=AllRightsReserved}" IsEnabled="{Binding IsEditable}" />
                                    <ComboBoxItem x:Name="licenseIsAttributionNoncommercialShareAlikeCC" Content="Attribution-NonCommercial-ShareAlike Creative Commons" IsSelected="{Binding Path=Picture.License, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=AttributionNoncommercialShareAlikeCC}" IsEnabled="{Binding IsEditable}" />
                                    <ComboBoxItem x:Name="licenseIsAttributionNoncommercialCC" Content="Attribution-NonCommercial Creative Commons" IsSelected="{Binding Path=Picture.License, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=AttributionNoncommercialCC}" IsEnabled="{Binding IsEditable}" />
                                    <ComboBoxItem x:Name="licenseIsAttributionNoncommercialNoDerivativesCC" Content="Attribution-NonCommercial-NoDerivs Creative Commons" IsSelected="{Binding Path=Picture.License, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=AttributionNoncommercialNoDerivativesCC}" IsEnabled="{Binding IsEditable}" />
                                    <ComboBoxItem x:Name="licenseIsAttributionCC" Content="Attribution Creative Commons" IsSelected="{Binding Path=Picture.License, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=AttributionCC}" IsEnabled="{Binding IsEditable}" />
                                    <ComboBoxItem x:Name="licenseIsAttributionShareAlikeCC" Content="Attribution-ShareAlike Creative Commons" IsSelected="{Binding Path=Picture.License, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=AttributionShareAlikeCC}" IsEnabled="{Binding IsEditable}" />
                                    <ComboBoxItem x:Name="licenseIsAttributionNoDerivativesCC" Content="Attribution-NoDerivs Creative Commons" IsSelected="{Binding Path=Picture.License, Mode=TwoWay, Converter={StaticResource enumConverter}, ConverterParameter=AttributionNoDerivativesCC}" IsEnabled="{Binding IsEditable}" />
                                </ComboBox>
                            </StackPanel>
                        </WrapPanel>
                    </Expander>
                    <Expander Header="{Binding Path=Sets.Description}" Margin="0,10,0,0" Padding="0,5,0,0" IsExpanded="{Binding Path=UISettings.SetsPanelIsExpanded, FallbackValue=True}">
                        <ListBox ItemsSource="{Binding Path=Sets.Items}" Style="{Binding FlickrCollectionListStyle}" IsEnabled="{Binding IsEditable}" />
                    </Expander>
                    <Expander Header="{Binding Path=Groups.Description}" Margin="0,10,0,0" Padding="0,5,0,0" IsExpanded="{Binding Path=UISettings.GroupsPanelIsExpanded, FallbackValue=True}">
                        <ListBox ItemsSource="{Binding Path=Groups.Items}" Style="{Binding FlickrCollectionListStyle}" IsEnabled="{Binding IsEditable}" />
                    </Expander>
                    <Expander Header="Location" Margin="0,10,0,0" IsExpanded="{Binding Path=UISettings.LocationPanelIsExpanded, FallbackValue=True}">
                        <StackPanel Orientation="Vertical">
                            <ItemsControl ItemsSource="{Binding LocationCommands}" Visibility="{Binding LocationCommandsVisibility}">
                                <ItemsControl.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <WrapPanel Orientation="Horizontal" />
                                    </ItemsPanelTemplate>
                                </ItemsControl.ItemsPanel>
                                <ItemsControl.ItemTemplate>
                                    <DataTemplate>
                                        <Button Content="{Binding Name}" ToolTip="{Binding Description}" Command="{Binding}" Margin="0,5,5,0" />
                                    </DataTemplate>
                                </ItemsControl.ItemTemplate>
                            </ItemsControl>
                            <Grid Margin="0,10,0,0" HorizontalAlignment="Left">
                                <TextBlock Text="No location defined" />
                                <svc:GeoLocationMap Visibility="{Binding Path=LocationVisibility}" Location="{Binding Path=Picture.Location, Mode=TwoWay}" IsReadOnly="True" Height="300" Width="400" />
                            </Grid>
                        </StackPanel>
                    </Expander>
                </StackPanel>
            </ScrollViewer>
            <Border Grid.Row="1" Style="{DynamicResource BorderStyle}" Background="Transparent" Padding="5" Margin="5" Visibility="{Binding InfoMessageVisibility}">
                <TextBlock FontStyle="Italic" Foreground="{DynamicResource InfoFontBrush}" HorizontalAlignment="Right" Margin="0,0,10,0" Text="{Binding InfoMessage}" />
            </Border>
        </Grid>
    </Grid>
</UserControl>